
var JieHeadCell = function(aoColumn, aoParentRow){

	JieCell.call(this, aoParentRow);
	
	this.columns = new Array();
	this.addColumn(aoColumn);
	this.setWidth(aoColumn.iWidth);
	this.isFixed = aoColumn.isFixed;
	
	this.cells = new Array();
	this.mergedCell = null;
	
}

JieHeadCell.prototype = JieCell.prototype;

JieHeadCell.prototype.addColumn = function(aoColumn){
	if(aoColumn == null) throw new Error(sGmsg["HCELL_001"]);
	this.columns.push(aoColumn);
};
JieHeadCell.prototype.setMergedCell = function(aoCell){
	if(aoCell == null) throw new Error(sGmsg["HCELL_002"]);
	this.mergedCell = aoCell;
};

/**
 * 合并单元。方法将根据方向参数纵向(1)或横向(0)合并单元格。
 * 方向参数(aiDirection)和单元格对象(aoCell)为必填项，如果不填，系统将抛出异常
 * 当选择为横向合并单元格时，列对象(aoColumn)也为必填项，如果不填，系统将抛出异常
 * @param {Object} aiDirection[必填] 方向参数当值为0时表示横向合并单元格，值为1时表示纵向合并单元格
 * @param {Object} aoCell[必填] 单元格对象，表示被合并的单元格
 * @param {Object} aoColumn[选填] 当横向合并单元格，即aiDirection值为0时，该项成为必填项
 */
JieHeadCell.prototype.mergeCell = function(aiDirection, aoCell, aoColumn){
	if(aiDirection == 0){
//		alert(Util.getLengthNumber(aoCell.getWidth()));
		this.setWidth(this.iWidth + Util.getLengthNumber(aoCell.getWidth())+1);
		aoCell.setDisplay(false);
		this.addColumn(aoColumn);
	}else if(aiDirection == 1){
//	alert(Util.getLengthNumber(aoCell.getHeight()));
		this.setHeight(this.iHeight + Util.getLengthNumber(aoCell.getHeight()));
		aoCell.setVisibility(false);
	}else{
		throw new Error(sGmsg["HCELL_003"]);
	}
	this.cells.push(aoCell);
	aoCell.setMergedCell(this);
};

